import axios from '@/utils/request';
const baseOriginURL = process.env.VUE_APP_BASE_ORIGIN + '/iot_device';
const baseProjectOriginURL = process.env.VUE_APP_BASE_ORIGIN + '/iot_project';
const baseMaintenanceOriginURL = process.env.VUE_APP_BASE_ORIGIN + '/iot_maintenance';

// 获取物模型列表
const getModelList = params => {
  return axios.get(baseOriginURL + '/device/getModelList', {
    params
  });
};

// 获取物模型详情
const getModelDetail = params => {
  return axios.get(baseOriginURL + '/device/getModelDetail', {
    params
  });
};

// 获取设备分组
const getDeviceGroupList = params => {
  return axios.get(baseOriginURL + '/group/getDeviceGroupList', {
    params
  });
};

// 获取设备列表
const getDeviceList = params => {
  return axios.get(baseOriginURL + '/device/getDeviceList', {
    params
  });
};

// 获取设备组态
const getDeviceScada = params => {
  return axios.get(baseOriginURL + '/device/getDeviceScada', {
    params
  });
};

// 获取设备列表-总数
const getDeviceCount = params => {
  return axios.get(baseProjectOriginURL + '/project/getDeviceCount', {
    params
  });
};

// 获取设备详情
const getDeviceDetail = params => {
  return axios.get(baseOriginURL + '/device/getDeviceDetail', {
    params
  });
};

// 获取设备运行参数
const getModelVariable = params => {
  return axios.get(baseOriginURL + '/device/getModelVariable', {
    params
  });
};

// 获取设备变量
const getDeviceVariable = params => {
  return axios.get(baseOriginURL + '/device/getDeviceVariable', {
    params
  });
};

// 设备实时数据-选择变量
const addDeviceVariable = data => {
  return axios.post(baseOriginURL + '/device/addDeviceVariable', data);
};

// 实时数据远程控制
const parameterDownload = data => {
  return axios.post(baseOriginURL + '/device/parameterDownload', data);
};

// 获取设备视频列表
const getDeviceVideo = params => {
  return axios.get(baseOriginURL + '/device/getDeviceVideo', {
    params
  });
};

// 获取工单记录
const getOrderList = params => {
  return axios.get(baseMaintenanceOriginURL + '/maintenance/getOrderList', {
    params
  });
};

// 获取设备报警记录
const getDeviceAlarmList = params => {
  return axios.get(baseOriginURL + '/device/getDeviceAlarmList', {
    params
  });
};

// 获取设备配件信息
const getModelAccessories = params => {
  return axios.get(baseOriginURL + '/device/getModelAccessories', {
    params
  });
};

// 获取设备知识库分类
const getKnowCategoryList = params => {
  return axios.get(baseMaintenanceOriginURL + '/maintenance/getKnowCategoryList', {
    params
  });
};

// 获取设备知识库
const getKnowListByDeviceModelId = params => {
  return axios.get(baseMaintenanceOriginURL + '/maintenance/getKnowListByDeviceModelId', {
    params
  });
};

// 获取设备知识库详情
const getKnowDetails = params => {
  return axios.get(baseMaintenanceOriginURL + '/maintenance/getKnowDetails', {
    params
  });
};

export {
  getModelList,
  getModelDetail,
  getDeviceGroupList,
  getDeviceList,
  getDeviceScada,
  getDeviceCount,
  getDeviceDetail,
  getModelVariable,
  getDeviceVariable,
  addDeviceVariable,
  parameterDownload,
  getDeviceVideo,
  getOrderList,
  getDeviceAlarmList,
  getModelAccessories,
  getKnowCategoryList,
  getKnowListByDeviceModelId,
  getKnowDetails
};
